package cn.tedu.medicalmanagementsystem.escort.pojo.entity;

import javax.validation.constraints.NotNull;
import java.util.Arrays;

public enum ServiceStatus {
    CREATED("created", "已创建"),
    CONFIRMED("confirmed", "已确认"),
    STARTED("started", "已开始"),
    COMPLETED("completed", "已完成"),
    CANCELLED("cancelled", "已取消");

    /*后端统一转为小写*/
    public static boolean isValid(@NotNull(message = "状态不能为空") ServiceStatus value) {
        return Arrays.stream(values())
                .anyMatch(v -> v.name().equalsIgnoreCase(String.valueOf(value)));
    }
    private final String value;
    private final String description;

    ServiceStatus(String value, String description) {
        this.value = value;
        this.description = description;
    }
    public String getValue() {
        return value;
    }
    public String getDescription() {
        return description;
    }
}
